// -*-c#-*-
// License: New BSD License : http://www.opensource.org/licenses/bsd-license.php
//
// Copyright (c) 2008, Brothers In Arms/Burl Nyswonger
//
// See: BiaVote.uc for full License
// 
//@L

Class BiaVoteInteraction extends Interaction;

/* ------------------------------------------------------------------------- */

`include( BiaVote/Classes/BiaStdInc.uci );
`include( BiaVote/Classes/BiaVote.uci );


/* ------------------------------------------------------------------------- */


var PlayerController    MyPlayerController; 
var BiaVoteClient       BVC;
var name                BiaVoteHotKey;

Function Initialized()
{
    `BiaEnter();
    if(BiaVoteHotKey == '')
    {
        BiaVoteHotKey = 'Home';
    }
    OnReceivedNativeInputKey = MyKeyEvent;
    `BiaExit();
}

function bool MyKeyEvent( int ControllerId, name Key, EInputEvent EventType, optional float AmountDepressed=1.f, optional bool bGamepad )
{

    `BiaDbg("KEY: " $ Key );
    
    if( Key == BiaVoteHotKey )
    {
        if (EventType == IE_Pressed)
        {
            if( BVC != None )
            {
                BVC.BiaVoteOpenUI();
                return true;
            }
        }
    }
    return false;
}

function NotifyGameSessionEnded()
{
    `BiaEnter();
    `BiaLog("Cleaning up references");
    Super.NotifyGameSessionEnded();
    BVC=None;
    MyPlayerController=None;
    `BiaExit();
}

defaultproperties
{
    BiaVoteHotKey=Home
}
